package net.NingXiaRuiTai.ShortChain.manager.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import net.NingXiaRuiTai.ShortChain.manager.AccountManager;
import net.NingXiaRuiTai.ShortChain.mapper.AccountMapper;
import net.NingXiaRuiTai.ShortChain.model.AccountDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class AccountManagerImpl implements AccountManager {
    @Autowired
    AccountMapper accountMapper;

    @Override
    public int insertAccount(AccountDO accountDO) {

        return accountMapper.insert(accountDO);
    }

    @Override
    public List<AccountDO> findByPhone(String phone) {
        List<AccountDO> accountDOList = accountMapper.selectList(new QueryWrapper<AccountDO>().eq("phone", phone));

        return accountDOList;
    }
}
